import random
import time
import WanXue.WXAPI as WXAPI
import WanXue.WXUtil as WXUtil

first_choice_id = 33560
COURSE_ID = 1644
time_stamp = 1572757350812

if __name__ == '__main__':
    em_ids = ["16549", "16550", "16551", "16552", "16554", "16555", "16557", "16558", "16559", "16560", "16561"]

    print(em_ids)

    cookie = WXAPI.fileGetCookie()
    # cookie = 'WXAPI.fileGetCookie()'

    for em_id in em_ids:
        ReqCtx = WXUtil.gen_random_req_ctx(first_choice_id, COURSE_ID, time_stamp + random.randint(1, 10) * 1000,
                                          '2_' + str(em_id))  # 生成请求完成课程的请求参数
        print(ReqCtx)  # 显示请求参数
        print(WXAPI.doCourse(ReqCtx, time_stamp, COURSE_ID, '2_' + str(em_id), cookie))  # 请求完成课程并显示Resp
        first_choice_id = first_choice_id + 10  # 题号自增10
        time.sleep(1)
